-
Notifications
You must be signed in to change notification settings - Fork 1.1k
allow passing env vars to server from command line #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
936345b to
8a7da27
Compare
jspahrsummers
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good! IMO supporting -- should be a blocker, but the other comments are not essential
| for (let i = 0; i < args.length; i++) { | ||
| if (args[i] === "-e" && i + 1 < args.length) { | ||
| const [key, value] = args[++i].split("="); | ||
| if (key && value) { | ||
| envVars[key] = value; | ||
| } | ||
| } else if (!command) { | ||
| command = args[i]; | ||
| } else { | ||
| mcpServerArgs.push(args[i]); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There must be an npm package that can make this easier, but nbd
bin/cli.js
Outdated
| let command = null; | ||
|
|
||
| for (let i = 0; i < args.length; i++) { | ||
| if (args[i] === "-e" && i + 1 < args.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should support -- to end arg parsing, in cases where you might have a server that accepts its own -e option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
client/src/components/Sidebar.tsx
Outdated
| }: SidebarProps) => { | ||
| const [theme, setTheme] = useTheme(); | ||
| const [showEnvVars, setShowEnvVars] = useState(false); | ||
| const [shownEnvVars, setShownEnvVars] = useState<Record<string, boolean>>({}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably just use a Set, but up to you
jerome3o-anthropic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one question - and I also agree that -- would be great to have here, but im happy to take that on as a follow up if you don't have time
client/src/components/Sidebar.tsx
Outdated
| newEnv[""] = ""; | ||
| newEnv[key] = ""; | ||
| setEnv(newEnv); | ||
| setShownEnvVars({}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this hide all previously shown env vars? intential?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch
00f9228 to
052de86
Compare
jspahrsummers
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allow passing env vars to server from command line

./bin/cli.js -e FOO=BAR /path/to/serverand have it pass the env var to the MCP server.Motivation and Context
Addresses #94.
How Has This Been Tested?
Verified with command above.
Breaking Changes
No
Types of changes
Checklist
Additional context